<?php
/**
 * @ClassName: Store
 * @Description: TODO
 * @author: gydtrade
 * @Date: 2025-10-08 13:42
 * @Version: V1.0.0
 */

namespace app\api\controller\store;

use app\api\controller\Api;
use app\common\model;

class Store extends Api
{
    function info()
    {
        $store_id = input('store_id', 0);

        $store = model\Store::get($store_id);

        if (!$store) {
            return json(['code' => 0, 'msg' => '店铺不存在']);
        }

        $result = [
            'id' => $store['id'],
            'merchant_id' => $store['merchant_id'],
            'store_id' => $store['id'],
            'audit_opinion' => $store['audit_opinion'],
            'checked' => false,
            // 基础信息
            'base_info' => [
                'user_type' => $store['user_type'],//用户类型，1联盟商家，2水站商家
                'contact_name' => $store['contact_name'],//店铺联系人姓名
                'contact_phone' => $store['contact_phone'],//店铺联系电话
                'email' => $store['email'],//邮箱
                'store_name' => $store['store_name'],//店铺名称
                'category_id' => $store['category_id'],//店铺分类
                'unity_category_id' => $store['unity_category_id'],//行业类目ID
                'remark' => $store['remark'],//备注
            ],
            // 店铺地址信息
            'address_info' => [
                'province_code' => $store['province_code'],//商户所在省
                'city_code' => $store['city_code'],//商户所在市
                'area_code' => $store['area_code'],//商户所在区县
                'store_area_str' => $store['store_area_str'],//商户所在地区
                'street_address' => $store['street_address'],//商户所在街道地址
                'longitude' => $store['longitude'],//商户经度
                'latitude' => $store['latitude'],//商户纬度
            ],
            // 门店信息
            'shop_info' => [
                'store_logo' => $store['store_logo'],//商户Logo
                'store_front_photo' => $store['store_front_photo'],//门头照
                'store_cash_photo' => $store['store_cash_photo'],//收银台照
                'store_env_photo' => $store['store_env_photo'],//店内环境照
                'delivery_distance' => $store['delivery_distance'],//配送距离
                'business_hours_start' => $store['business_hours_start'],//开始营业时间
                'business_hours_end' => $store['business_hours_end'],//结束营业时间
                'business_status' => $store['business_status'],//经营状态，0休息中，1营业中
                'business_week' => $store['business_week'],//营业日
                'business_weeks' => explode(',', $store['business_week']),
            ],
        ];

        return json(['code' => 1, 'msg' => 'OK', 'data' => $result]);
    }

}